﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Styx.TreeSharp;
using Attack = HolySword.Helpers.AttackManager;
using Movement = HolySword.Helpers.MovementManager;
using Styx.WoWInternals.WoWObjects;
using HolySword.Helpers;
using Styx.WoWInternals;
using Styx;

namespace HolySword.Behaviours
{
    class Combat
    {
        private static LocalPlayer Me = HolySword.Me;

        public static Composite DoRetribution()
        {
            return DoHoly();
        }

        public static Composite DoProtection()
        {
            return DoHoly();
        }

        public static Composite DoHoly()
        {
            if (StyxWoW.Me.IsInRaid)
            {

            }
            
            if (StyxWoW.Me.IsInParty)
            {
                
            }


            if (!StyxWoW.Me.IsInParty)
            {
                return
                new PrioritySelector(
                    //Disabled-Breaker
                    Spell.CastSpell(Racials.EveryManForHimself, ret => Me.IsDisabled, "breaking disabled"),
                    TargetManager.NeedTarget(),
                    Movement.CreateFaceTargetBehavior(),
                    Movement.CreateMoveToLosBehavior(),
                    Movement.MaxRangeBehaviour(),
                    Attack.CreateAutoAttack(),
                    //selfheal
                    new Decorator(ret => Me.HealthPercent < 70,
                                  new PrioritySelector(
                                      Spell.CastSpell(Paladin.HolyShock, ret => Me.HealthPercent < 70, "Holy Shock [70% hp]"),
                                      Spell.CastSpell(Paladin.WordofGlory, ret => Me, ret => Me.HealthPercent < 40 && Me.CurrentHolyPower >= 3, "Word of Glory [40%hp, 3HOLYPOWER]"),
                                      Spell.CastSpell(Paladin.FlashofLight, ret => Me, ret => !Me.IsMoving && Me.HealthPercent < 50, "Flash of Light [50% hp]")
                                      )
                        ),
                    //interrupt
                    Spell.CastSpell(Paladin.Rebuke, ret => Me.CurrentTarget, ret => Me.CurrentTarget.IsCasting && Me.CurrentTarget.Distance < 4, "Interrupt"),
                    //manareg
                    Spell.CastSpell(Paladin.DivinePlea, ret => Me.ManaPercent < 80, "manareg"),
                    //dmg
                    new Decorator(ret => Me.CurrentTarget != null,
                                  new PrioritySelector(
                                      Spell.CastSpell(Paladin.HammerofWrath, ret => Me.CurrentTarget, ret => Me.CurrentTarget.HealthPercent < 20, "STOP! [Hammertime]"),
                                      //Spell.CastSpell(Paladin.HolyShock, ret => Me.CurrentTarget, ret => Me.HealthPercent >= 70, "Holy Shock [dmg, HOLYPOWER]"),
                                      //Spell.CastSpell(Paladin.CrusaderStrike, ret => Me.CurrentTarget, ret => Me.CurrentHolyPower < 3 && Me.CurrentTarget.Distance < 4, "Crusader Strike [HOLYPOWER]"),
                                      //Spell.CastSpell(Paladin.Judgment, ret => Me.CurrentTarget, ret => Me.CurrentTarget.Distance < 30, "just because"),
                                      Spell.CastSpell(Paladin.Denounce, ret => Me.CurrentTarget, ret => true, "Denounce")
                                      )
                        )
                    );
            }
        }
    }
}
